package com.demo.systemmonitor.data;

/**
 * CPU实时数据模型类，存储CPU利用率、频率等动态变化的数据
 */
public class CpuData {
    private float usage;         // CPU利用率（百分比）
    private String speed;        // 当前CPU频率
    private float frequency;     // CPU频率（MHz）
    private int processes;       // 进程数量
    private int threads;         // 线程数量
    private int handles;         // 句柄数量
    private Float temperatureC;  // CPU温度（摄氏度），不可用为 null

    public CpuData(float usage, String speed, float frequency, int processes, int threads, int handles, Float temperatureC) {
        this.usage = usage;
        this.speed = speed;
        this.frequency = frequency;
        this.processes = processes;
        this.threads = threads;
        this.handles = handles;
        this.temperatureC = temperatureC;
    }

    // Getter方法
    public float getUsage() {
        return usage;
    }

    public String getSpeed() {
        return speed;
    }

    public float getFrequency() {
        return frequency;
    }

    public int getProcesses() {
        return processes;
    }

    public int getThreads() {
        return threads;
    }

    public int getHandles() {
        return handles;
    }

    public Float getTemperatureC() {
        return temperatureC;
    }

    // Setter方法
    public void setUsage(float usage) {
        this.usage = usage;
    }

    public void setSpeed(String speed) {
        this.speed = speed;
    }

    public void setFrequency(float frequency) {
        this.frequency = frequency;
    }

    public void setProcesses(int processes) {
        this.processes = processes;
    }

    public void setThreads(int threads) {
        this.threads = threads;
    }

    public void setHandles(int handles) {
        this.handles = handles;
    }

    public void setTemperatureC(Float temperatureC) {
        this.temperatureC = temperatureC;
    }
}
